#ifndef __EPAPER_H
#define __EPAPER_H

#include "nrf_delay.h"
#include "boards.h"

//250*122///////////////////////////////////////

#define MONOMSB_MODE 1
#define MONOLSB_MODE 2 
#define RED_MODE     3

#define MAX_LINE_BYTES 16  //=128/8
#define MAX_COLUMN_BYTES  296

#define ALLSCREEN_GRAGHBYTES	4736

///////////////////////////GPIO Settings//////////////////////////////////////////////////////

#define EPD_W21_MOSI_0	nrf_gpio_pin_clear(EPD_SDI)
#define EPD_W21_MOSI_1	nrf_gpio_pin_set(EPD_SDI)

#define EPD_W21_CLK_0	nrf_gpio_pin_clear(EPD_SCLK)
#define EPD_W21_CLK_1	nrf_gpio_pin_set(EPD_SCLK)

#define EPD_W21_CS_0	nrf_gpio_pin_clear(EPD_CS)
#define EPD_W21_CS_1	nrf_gpio_pin_set(EPD_CS)

#define EPD_W21_DC_0	nrf_gpio_pin_clear(EPD_DC)
#define EPD_W21_DC_1	nrf_gpio_pin_set(EPD_DC)

#define EPD_W21_RST_0	nrf_gpio_pin_clear(EPD_RST)
#define EPD_W21_RST_1	nrf_gpio_pin_set(EPD_RST)

#define EPD_W21_BUSY_LEVEL 0
#define isEPD_W21_BUSY nrf_gpio_pin_read(EPD_BUSY)

void Epaper_READBUSY(void);
void Epaper_Spi_WriteByte(unsigned char TxData);
void Epaper_Write_Command(unsigned char cmd);
void Epaper_Write_Data(unsigned char data);

void EPD_HW_Init(void); //Electronic paper initialization
void EPD_Update(void);

void EPD_DeepSleep(void);
//Display 
void EPD_WhiteScreen_ALL(const unsigned char *BW_datas,const unsigned char *R_datas);
void EPD_WhiteScreen_ALL_Clean(void);

#endif // __EPAPER_H


